package com.fsnbigdata.repository;

import com.fsnbigdata.domain.AnimalConservation;
import com.fsnbigdata.domain.AnimalConservationImage;
import io.springlets.data.jpa.repository.DetachableJpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.roo.addon.layers.repository.jpa.annotations.RooJpaRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by zq on 2019/4/20.
 */
@RooJpaRepository(entity = AnimalConservationImage.class)
@Transactional(readOnly = true)
public interface AnimalConservationImageRepository extends DetachableJpaRepository<AnimalConservationImage, Long>, AnimalConservationImageRepositoryCustom{

    /**
     * TODO Auto-generated method documentation
     *
     * @param
     * @return Long
     */
    public abstract long countByAnimalConservation(AnimalConservation animalConservation);

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return
     */
    public abstract AnimalConservationImage findOne(Long id);

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return List
     */
    public abstract List<AnimalConservationImage> findAll(Iterable<Long> id);

    /**
     * TODO Auto-generated method documentation
     *
     * @param
     * @return EndangeredSpeciesImage
     */
    public abstract AnimalConservationImage save(AnimalConservationImage AnimalConservationImage);

    @Query(value = "select url from animal_conservation_image where animal_conservation_id = ?1",nativeQuery = true)
    public List<String> getUrl(String id);
}
